#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e5+10;
typedef long long ll;
ll n, idx=1, x, a[MAXN], ans;
map <ll, ll> m;
int main(){
    freopen("duel.in", "r", stdin);
    freopen("duel.out", "w", stdout);
    cin>>n;
    for(ll i=1;i<=n;i++){
        cin >> x;
        if(!m[x]) a[idx++] = x;
        m[x]+=1;
    }
    sort(a+1, a+1+idx);
    ll sy = m[a[1]];
    for(ll i = 2;i<=idx;i++)
       if(m[a[i]] > sy) ans += sy, sy = m[a[i]];
       else ans += m[a[i]];
    cout << n-ans;
    return 0;
}